
function generateKLineData(days = 100) {
  const data = [];
  const basePrice = 100 + Math.random() * 50;
  let lastClose = basePrice;
  
  for (let i = 0; i < days; i++) {
    const date = new Date(2025, 4, 22 - i); // 从当前日期倒推
    const volatility = 0.02 + Math.random() * 0.03;
    const open = lastClose;
    const close = open * (1 + (Math.random() - 0.5) * volatility);
    const high = Math.max(open, close) * (1 + Math.random() * 0.01);
    const low = Math.min(open, close) * (1 - Math.random() * 0.01);
    const volume = Math.floor(1000000 + Math.random() * 9000000);

    data.push({
      time: date.getTime(),
      open: Number(open.toFixed(2)),
      close: Number(close.toFixed(2)),
      high: Number(high.toFixed(2)),
      low: Number(low.toFixed(2)),
      volume: volume
    });

    lastClose = close;
  }

  return data.reverse(); // 按时间正序排列
}

// 导出100条数据
export default {
	generateKLineData
}